home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
039a
/
uw201.zip
/
UW_HELP3.HLP
< prev
next >
Wrap
Text File
|
1991-10-07
|
20KB
|
632 lines
`co(4,7);──────────────────────── /// The Keyboard/Mouse ────────────────────────────`co();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(init_mouse,/// init_mouse); `keyword(end_mouse ,/// end_mouse); `keyword(m_reset ,/// m_reset); │
│ `keyword(set_idle_func,/// set_idle_func); `keyword(wait_event,/// wait_event); `keyword(event_pending,/// event_pending); │
│ `keyword(wait_ticks,/// wait_ticks); `keyword(check_key ,/// check_key); `keyword(get_key ,/// get_key); │
│ `keyword(m_hide,/// m_hide); `keyword(m_show ,/// m_show); `keyword(m_pos ,/// m_pos); │
│ `keyword(m_moveto,/// m_moveto); `keyword(m_pressed ,/// m_pressed); `keyword(m_released ,/// m_released); │
│ `keyword(m_colrange,/// m_colrange); `keyword(m_rowrange,/// m_rowrange); `keyword(m_motion ,/// m_motion); │
│ `keyword(m_lpen_on,/// m_lpen_on); `keyword(m_lpen_off,/// m_lpen_off); `keyword(m_ratio ,/// m_ratio); │
└──────────────────────────────────────────────────────────────────────────┘
The UltraWin library interfaces to the user through either the
keyboard, mouse, or both! The keyboard routines support all possible
key presses which include left and right Shift, Alt, and Ctrl key
combinations.
The mouse routines allow complete control of a two or three button
mouse, and is Microsoft driver compatible. The event routines handle
detecting both mouse and keyboard presses for you, so making your
programs support a mouse is a snap!
In addition, UltraWin allows you to define your own background
function, which is called any place in the library that waits for
user input. This allows you to write your own processing routines to
be performed in the background, then call one function to notify the
library of your routine, then just forget all about it! Refer to
the set_idle_func and wait_event functions for details.
`co(10,1);/// init_mouse`co(); `keyword(source,[UW_EVENT.C]~init_mouse);
Call this function just after init_video or force_video if you wish
to use the mouse in your program. If the mouse is connected and a
driver is installed, then the global variable Mouse_exists is
set to TRUE (1). In addition the mouse cursor column and row ranges
are set to cover the entire text screen. After calling this function
you may show the mouse on the screen using the function m_show.
Prototype:
void init_mouse();
Parameters:
None.
Usage:
init_mouse();
`co(10,1);/// end_mouse`co(); `keyword(source,[UW_EVENT.C]~end_mouse);
If the mouse was found to be present in init_mouse, this function
turns the mouse back off. This keeps the mouse from being active at
the DOS prompt. Call this prior to exiting your program if your
program called init_mouse or the lower level m_reset function.
Prototype:
void end_mouse();
Parameters:
None.
Usage:
end_mouse();
`co(10,1);/// m_reset`co(); `keyword(source,[UW_EVENT.C]~m_reset);
This is the lower level function called by both init_mouse and
end_mouse. It is used both to determine if the mouse exists, and
also to reset the mouse prior to program exit.
Prototype:
void m_reset(M_RESET *m)
Parameters:
`co(11,1); M_RESET *m`co();
A variable of type M_RESET. Refer to the structures/globals
topic for information on the members of this structure.
Usage:
M_RESET m;
...
m_reset(&m);
`co(10,1);/// set_idle_func`co(); `keyword(source,[UW_EVENT.C]~set_idle_func);
This function allows you to define your own background process.
Simply write your own C function, keeping in mind that to remain
responsive to the keyboard you should keep your code tight and
fast. Then call set_idle_func with the pointer to your function.
Prototype:
void set_idle_func( int (*func_ptr)() );
Parameters:
`co(11,1); int (*func_ptr)()`co();
A pointer to the function you wish to install as the idle function.
Usage:
process()
{
...
}
...
set_idle_func( process );
`co(10,1);/// wait_event`co(); `keyword(source,[UW_EVENT.C]~wait_event);
This function simply waits until either a key is pressed, or a mouse
button is clicked. The global variable Event will contain the
information about the event. If it is a keyboard event, the key or
combination of keys pressed is saved. If a mouse event, then the
button that was pressed, how many times it was pressed, and the x
and y coordinate at which the press occurred is saved.
While UltraWin waits for user input, it is free to perform background
processing. If a user defined function has been installed with
set_idle_func, that function will be called during idle time.
Prototype:
void wait_event();
Parameters:
None.
Usage:
wait_event();
`co(10,1);/// event_pending`co(); `keyword(source,[UW_EVENT.C]~event_pending);
This function will check for an event, and will return TRUE (1) if
an event has occurred or FALSE (0) if no event has occurred. If
an event has occurred, then the information about the event, which
includes the event type (keyboard or mouse), the key and modifier,
or the mouse location and button status is returned in the global
Event variable. Refer to the Event Structures topic for information
about the EVENT structure and member names for extracting this
information.
Prototype:
int event_pending();
Parameters:
None.
Usage:
int status;
...
status = event_pending();
`co(10,1);/// wait_ticks`co(); `keyword(source,[UW_EVENT.C]~wait_event);
This function simply waits for a given number of system ticks. There
are 18.2 system ticks per second. If you have defined a background
process with the set_idle_func function, it will call your process
function while it waits for the given ticks to pass. UltraWin 2.0 has
enhanced timer support. See `keyword(Timer Support,[uw_help4.hlp]/// Timer Support); for further details.
Prototype:
void wait_ticks( int ticks );
Parameters:
`co(11,1); int ticks`co();
The number of system ticks to wait.
Usage:
wait_ticks( 9 );
`co(10,1);/// check_key`co(); `keyword(source,[UW_EVENT.C]~check_key);
This function will check to see if a key has been pressed, and will
return the key without pulling it out of the keyboard buffer. The
key value will be returned (see uw_keys.h for key defines). If no
key has been pressed, then check_key will return FALSE (0).
Prototype:
int check_key();
Parameters:
None.
Usage:
int key;
...
key = check_key();
`co(10,1);/// get_key`co(); `keyword(source,[UW_EVENT.C]~get_key);
This function will wait until a key has been pressed, and return the
key value (see uw_keys.h for key defines).
Prototype:
int get_key();
Parameters:
None.
Usage:
int key;
...
key = get_key();
`co(10,1);/// m_hide`co(); `keyword(source,[UW_EVENT.C]~m_hide);
Hides the mouse cursor. Call this function to remove the mouse
cursor temporarily from the screen when you are doing window output.
Call the m_show function after your window output to put the cursor
back on the screen.
NOTE: Even though the mouse is not shown on the screen, the cursor
will still track with the mouse, and mouse buttons are still active.
Prototype:
void m_hide();
Parameters:
None.
Usage:
m_hide();
`co(10,1);/// m_show`co(); `keyword(source,[UW_EVENT.C]~m_show);
Show the mouse cursor. This is used to undo the affect of m_hide.
Prototype:
void m_show();
Parameters:
None.
Usage:
m_show();
`co(10,1);/// m_pos`co(); `keyword(source,[UW_EVENT.C]~m_pos);
Get the current location of the mouse, as well as the status of
the buttons.
Prototype:
void m_pos( M_LOC *m )
Parameters:
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that contains the position
and button status information. Refer to the structures/globals
topic above for information about the M_LOC structure.
Usage:
M_LOC m;
...
m_pos( &m );
`co(10,1);/// m_moveto`co(); `keyword(source,[UW_EVENT.C]~m_moveto);
Moves the mouse to the position specified by column and row.
Prototype:
void m_moveto( int col, int row );
Parameters:
`co(11,1); int col, row`co();
The column and row at which the mouse cursor is to be placed.
Usage:
m_moveto( 10, 25 );
`co(10,1);/// m_pressed`co(); `keyword(source,[UW_EVENT.C]~m_pressed);
Checks to see if the button passed has been pressed since the last
call to this function, and return the button count (number of
clicks) and the location where the click occurred. A press has
occurred when the count M_LOC member is greater than 0.
Prototype:
void m_pressed( int button, M_LOC *m );
Parameters:
`co(11,1); int button`co();
The button to test for being pressed. This can be one of the
defines (in uw.h) LB, MB, or RB.
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that the function will use
to place the position and button status information.
Usage:
M_LOC m;
...
m_pressed( LB, &m );
`co(10,1);/// m_released`co(); `keyword(source,[UW_EVENT.C]~m_released);
This performs the same function as m_pressed, but is used to test when
the mouse button is released.
Prototype:
void m_released( int button, M_LOC *m );
Parameters:
`co(11,1); int button`co();
The button to test for being released. This can be one of the
defines (in uw.h) LB, MB, or RB.
`co(11,1); M_LOC *m`co();
A pointer to a variable of type M_LOC that the function will use
to place the position and button status information.
Usage:
M_LOC m;
...
m_released( LB, &m );
`co(10,1);/// m_colrange`co(); `keyword(source,[UW_EVENT.C]~m_colrange);
Allows the user to set the range of columns that the mouse will be
allowed to move within. Typically this will be from 0 to V_cols-1,
but you may set it to a range less than this if you wish to keep
the mouse inside a subrange of the screen.
Prototype:
void m_colrange( int col_min, int col_max );
Parameters:
`co(11,1); int col_min, col_max`co();
The column mininum and maximum values.
Usage:
m_colrange( 0, V_cols );
`co(10,1);/// m_rowrange`co(); `keyword(source,[UW_EVENT.C]~m_rowrange);
The complement function to m_colrange. Typically this will be
from 0 to V_rows-1, but like m_colrange you may set it to a range
less than this if you wish to keep the mouse inside a subrange
of the screen.
Prototype:
void m_rowrange( int row_min, int row_max );
Parameters:
`co(11,1); int row_min, row_max`co();
The row mininum and maximum values.
Usage:
m_rowrange( 0, V_rows );
`co(10,1);/// m_motion`co(); `keyword(source,[UW_EVENT.C]~m_motion);
Reports the net motion of cursor since last call to this function.
A pointer to a variable of type M_MOVE is used to pass back the
information.
Prototype:
void m_motion( M_MOVE *m );
Parameters:
`co(11,1); M_MOVE *m`co();
A pointer to a variable of type M_MOVE. See structures/globals
for information on the M_MOVE members.
Usage:
M_MOVE mv;
...
m_motion( &mv );
`co(10,1);/// m_lpen_on`co(); `keyword(source,[UW_EVENT.C]~m_lpen_on);
Turns on light pen emulation. This is the default.
Prototype:
void m_lpen_on();
Parameters:
None.
Usage:
m_lpen_on();
`co(10,1);/// m_lpen_off`co(); `keyword(source,[UW_EVENT.C]~m_lpen_off);
Turns off light pen emulation.
Prototype:
void m_lpen_off();
Parameters:
None.
U ge:
m_lpen_off();
`co(10,1);/// m_ratio`co(); `keyword(source,[UW_EVENT.C]~m_ratio);
Sets mouse to pixel ratio. The default values are 16 for horizontal
and 8 for vertical.
Prototype:
void m_ratio( int horiz, int vert );
Parameters:
`co(11,1); int horiz, vert`co();
The values for the new horizontal and vertical ratios.
Usage:
m_ratio( 12, 8 );
`co(4,7);──────────────────────── /// The Window Manager ────────────────────────────`co();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(add_window,/// add_window); `keyword(remove_window,/// remove_window); `keyword(make_top_window,/// make_top_window); │
│ `keyword(cr_inwindow,/// cr_inwindow); `keyword(move_wn_left,/// move_wn_left); `keyword(move_wn_right,/// move_wn_right); │
│ `keyword(move_wn_up,/// move_wn_up); `keyword(move_wn_down,/// move_wn_down); `keyword(reset_all_masks,/// reset_all_masks); │
│ `keyword(refresh_desktop,/// refresh_desktop); `keyword(refresh_column,/// refresh_column); `keyword(refresh_row,/// refresh_row); │
│ `keyword(refresh_rect,/// refresh_rect); │
└──────────────────────────────────────────────────────────────────────────┘
The window manager is a set of routines that make having multiple
windows on the screen at once a snap! By using the window manager,
you bypass having to keep track of window masking and refreshing,
as the manager takes care of all the nitty gritty details of multiple
overlapping windows! To use the manager, first create a window with
wn_create that is the size of the screen, and call add_window with
that window. This is your background, or desktop window. Then you
can add any number (limited only by the amount of memory you have
in your computer) of windows of any size, regardless of whether
they overlap each other, and output text to that window using any
of the window I/O routines.
`co(10,1);/// add_window`co(); `keyword(source,[UW_ENTRY.C]~add_window);
This function takes the window created with wn_create by pointer
and adds it to the window manager's linked list. The window is
placed on the screen, and if it overlaps any other window, then
their masks are set to prevent output to the area that overlaps.
The window is then drawn on the video screen.
Prototype:
WINDOW *add_window( WINDOW *wnp )
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window created with wn_create.
Usage:
WINDOW wn;
...
add_window( &wn );
`co(10,1);/// remove_window`co(); `keyword(source,[UW_WIN.C]~remove_window);
Takes the window by pointer, and removes it from the linked list.
Reset any window's masks that were overlapped by the removed window,
and redraw any portion of any window that was covered by the removed
window. Please note that this function calls wn_destroy, so it is
not necessary to destroy the window once it has been removed from the
linked list!
Prototype:
int remove_window( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to remove.
Usage:
WINDOW wn;
...
remove_window( &wn );
`co(10,1);/// make_top_window`co(); `keyword(source,[UW_WIN.C]~make_top_window);
This function takes a pointer to the window, and if that window is
not the top window, it makes it the top window. All adjustments
in the masks for all windows are made, and the window is drawn to
the screen.
Prototype:
int make_top_window( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to bring to the top.
Usage:
WINDOW *wnp;
...
make_top_window(wnp);
`co(10,1);/// cr_inwindow`co(); `keyword(source,[UW_WIN.C]~cr_inwindow);
This function takes a location on the screen, and returns the
topmost window that contains that location. If there is no window
under the location, then a NULL is returned.
Prototype:
WINDOW *cr_inwindow( int col, int row )
Parameters:
`co(11,1); int col, row`co();
The col,row coordinate (x,y) to check.
Usage:
WINDOW *wnp;
...
wnp = cr_inwindow( 20, 37 );
`co(10,1);/// move_wn_left`co(); `keyword(source,[UW_WIN.C]~move_wn_left);
Takes a window in the manager's linked list, and moves it smoothly to
the left a given number of columns.
Prototype:
void move_wn_left( int cols, WINDOW *wnp );
Parameters:
`co(11,1); int cols`co();
The number of columns to move left.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_left( 3, wnp );
`co(10,1);/// move_wn_right`co(); `keyword(source,[UW_WIN.C]~move_wn_right);
Takes a window in the manager's linked list, and moves it smoothly to
the right a given number of columns.
Prototype:
void move_wn_right( int cols, WINDOW *wnp );
Parameters:
`co(11,1); int cols`co();
The number of columns to move right.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_right( 2, wnp );
`co(10,1);/// move_wn_up`co(); `keyword(source,[UW_WIN.C]~move_wn_up);
Takes a window in the manager's linked list, and moves it smoothly up
a given number of rows.
Prototype:
void move_wn_up( int rows, WINDOW *wnp );
Parameters:
`co(11,1); int rows`co();
The number of rows to move up.
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
move_wn_up( 1, wnp );
`co(10,1);/// move_wn_down`co(); `keyword(source,[UW_WIN.C]~move_wn_down);
Takes a window in the manager's linked list, and moves it smoothly down
a given number of rows.
Prototype:
void move_wn_down( int rows, WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp;`co();
A pointer to the window to move.
`co(11,1); int rows`co();
The number of rows to move down.
Usage:
WINDOW *wnp;
...
move_wn_down( 1, wnp );
`co(10,1);/// reset_all_masks`co(); `keyword(source,[UW_WIN.C]~reset_all_masks);
Walks through all the windows in the manager's linked list, and
resets their output masks so that only the areas of the windows
visible get written upon window output. Calling this function is
not necessary unless you adjust a window's mask yourself, and want
to set all window masks back to their default state.
Prototype:
void reset_all_masks();
Parameters:
None.
Usage:
reset_all_masks();
`co(10,1);/// refresh_desktop`co(); `keyword(source,[UW_WIN.C]~refresh_desktop);
This function walks through the linked list of windows and redraws
each. This is a quick way to redisplay the screen. It can be
useful when returning from executing another program, returning
from graphics mode, etc...
Prototype:
void refresh_desktop();
Parameters:
None
Usage:
refresh_desktop();
`co(10,1);/// refresh_column`co(); `keyword(source,[UW_WIN.C]~refresh_column);
This function walks through the linked list of windows checks to
see if each window contains a particular column. If the window
contains the column, then only that column is refreshed.
This function is used internally by wn_move_left and wn_move_right.
Prototype:
void refresh_column( int col )
Parameters:
`co(11,1); int col`co();
The column to refresh (redraw).
Usage:
refresh_column( 20 );
`co(10,1);/// refresh_row`co(); `keyword(source,[UW_WIN.C]~refresh_row);
This function is the complement of refresh_column, and is used
internally by wn_move_up and wn_move_down.
Prototype:
void refresh_row( int row )
Parameters:
`co(11,1); int row`co();
The row to refresh (redraw).
Usage:
refresh_row( 5 );
`co(10,1);/// refresh_rect`co(); `keyword(source,[UW_WIN.C]~refresh_rect);
This function refreshes a rectangular portion of the manager's
screen, defined by a variable of type RECT. The window manager
calls this function when a window is removed with remove_window.
The window's pane is used as the rectangular area passed.
NOTE: Use the set_rect function to define a variable of type RECT.
Prototype:
void refresh_rect( RECT r );
Parameters:
`co(11,1); RECT r`co();
The rectangular area to refresh.
Usage:
RECT r;
...
refresh_rect( r );
`co(4,7);─ End ──────────────────────────────────────────────────────────────────────`co();`sound(1024,10);